package cn.agiledata.bank.transaction.logic;

import java.util.Date;

import cn.agiledata.bank.common.util.Constant;
import cn.agiledata.bank.hibernateBean.PeerInnerAccount;

/**
 * 交易对方账户封装器
 * 
 * @author maxianbo
 * 
 */
public final class PeerInnerAccountWrapper extends PeerAccountAmount {
    private boolean selected;

    private PeerInnerAccount peerAccount;

    public PeerInnerAccountWrapper(PeerInnerAccount peerAccount) {
        super(peerAccount.getId().longValue());
        this.peerAccount = peerAccount;
    }

    public boolean isSelected() {
        return this.selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public String getEmail() {
        // 如果预设账户的email状态不正常，则令其email为null
        if (!Constant.ACCOUNT_STATE_NORMAL.equals(this.peerAccount
                .getPeerAccount().getEmStatus())) {
            return null;
        }
        return this.peerAccount.getPeerAccount().getEmail();
    }

    public String getMobile() {
        // 如果预设账户的mobile状态不正常，则令其mobile为null
        if (!Constant.ACCOUNT_STATE_NORMAL.equals(this.peerAccount
                .getPeerAccount().getMobStatus())) {
            return null;
        }
        return this.peerAccount.getPeerAccount().getMobile();
    }

    public String getName() {
        return this.peerAccount.getPeerAccount().getName();
    }

    public Date getUpdateTime() {
        return this.peerAccount.getUpdateTime();
    }
}
